﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Eleanor.Website.Utility
{
    public static class WebViewExtensions
    {
        public static string GetPaintListSubjectUrl(this  WebViewPage webViewPage, string subject)
        {
            UrlParameters urlParameters = webViewPage.ViewBag.UrlParameters as UrlParameters;
            return urlParameters.GetListSubjectPath(subject);
        }

        public static string GetPaintListSubjectUrl(this  WebViewPage webViewPage, string catalogName, string subject)
        {
            UrlParameters urlParameters = webViewPage.ViewBag.UrlParameters as UrlParameters;
            urlParameters["catalog"] = catalogName;
            return urlParameters.GetListSubjectPath(subject);
        }

        public static string GetPaintListAuthorshipUrl(this WebViewPage webViewPage, string authorship)
        {
            UrlParameters urlParameters = webViewPage.ViewBag.UrlParameters as UrlParameters;
            return urlParameters.GetListAuthorshipPath(authorship);
        }

        public static string GetPaintDetailUrl(this WebViewPage webViewPage, string catalogName)
        {
            return string.Format("/painting/detail/{0}-{1}?catalog={2}", webViewPage.ViewBag.Painting.PaintingNumber
                , webViewPage.ViewBag.Painting.PaintingNumber, catalogName);
        }
    }
}